Farmor's answer is nearly there, the explanation is that the ROM on the phone contains the phone's firmware (again, Cristi's explanation is nearly complete - you can write to ROM, but that's why you need root access to reflash your phone. If it was completely ROM, how would you get anything on there in the first place? =P )
By replacing the firmware, the ROM of the phone is wiped and the new firmware has complete control over it, which is why the two terms are seen as synonymous.
However the other terms that you have mentioned aren't synonymous:
Firmware - a specific subset of software which determines how a device will run, normally referring to embedded code such as that on a microcontroller. In our case, the firmware is loaded onto the ROM (the hardware component)
Hardware component - this is the physical device, or the physical bit of ROM which is in the phone/similar device. As the Firmware is loaded onto the ROM, people use these interchangeably, which isn't strictly true (think of coding a microcontroller - if you put some new software onto it, then the function completely changes, so it's like a new microcontroller, but it's still the same piece of hardware)
Operating system - this is Android. CyanogenMod (as your example) is Android-based, not a completely new OS. Rather than being a new OS, it is an extension of it.