3-pin plugs fit 4-pin header (PWM pin is outside of plug)and 4-pin plugs fit 3-pin headers. (no PWM pin into plug).
The spacing between the ribs on 3-pin and 4-pin plugs is the same, as is the index tab on header.
The first 3 pins of are almost always the same:
1st pin = Ground to/from header
2nd pin = Power to/from header (usually variable voltage controlled)
3rd pin = RPM signal from fan.to header
4th pin is only used when it is a PWM controlled header. 1st and 3rd pins remain the same and 2nd pin fixed voltage:
2nd pin = Constant 12 Volt Power
4th pin = PWM control when 2nd pin is constant 12 volt power.