It's not as easy as saying "if it's blue it's better".
Whether or not a module is better, at least in regards to Thrusters, FSD, and Shields, depends entirely on your ship's mass - and therefore on how you're setting your ship up. So in order to maximise your ship's potential, you need to understand the relationship between mass and optimal mass.
A Trader (at least a good one, anyway!) is always going to have a heavy ship full of cargo. That means their optimal mass is going to be high.
A Bounty Hunter isn't likely going to be carrying cargo, and may not even install cargo racks, so will probably generally have a fairly light ship. That means their optimal mass is going to be low.
So let's say you're flying a Cobra, your mass (even fully laden) is never greter than 250t, and you've spotted two thrusters for sale both of which you can install;
Mark 4H Thruster. 250t optimal mass. 300t mass limit.
Mark 3A Trhuster. 150t optimal mass. 280t mass limit.
If you're a trader, you've filled your Cobra with cargo racks. When fully laden, your ship's mass is 270t. 270 is closer to 250 than 150, so the 4H thruster will give your ship a faster top speed than the 3A.
If you're a bounty hunter, you've probably ripped out those unnecessary cargo racks so your ship's mass is 170t. 170 is closer to 150 than to 250, so the 3A thruster will give your ship a faster top speed than the 4H.
To go a little deeper, let's say you've also found a Mark 4A Thruster, with 280t optimal mass. Clearly the Bounty Hunter is still better off with the 3A, but the Trader's 270t mass is closer to the 4A's optimal than the 4H's, so the 4A will be faster.
So you see, it isn't as simple as saying "My ship is a Cobra with a Mark 4 thruster slot, therefore I should just look for the best Mark 4 thruster". It's about your optimal mass.
However, it is worth noting that this doesn't count for modules that don't require optimal ranges. A cargo rack is just a cargo rack, so if you're a trader with a Mark 4 internal compartment then you'll always be looking for the highest rated mark 4 cargo rack.