The letters are the quality. A is best.
The numbers are the size. Bigger is generally better, depending on the ship, though there's a weight tradeoff.
A too-small A-grade module will be worse than a correctly-sized module. For some stuff (cargo racks, for example) this doesn't matter as much, because the smaller one still works. But an A-grade size 3 FSD is too small for a Cobra and is therefore worse than a grade-D size 4.