Yup E was used to designate chassis codes.
Instead of going to triple digit E numbers, they started over using F numbers starting with the 7 series being the F01.
M used to designate different regular engines but once again they move away from that and use N to designate engines now.
S is used to designate special motors that the M division built.
M50 was the motor used in the e36 and e34 from 92 to 96.
S50 was the motor used in the e36 m3 in 1995.
If you want to get more technical after the designation bmw would include a B number to show displacement size as they could the same motor with different displacements.
For example the inline 6 used in the e30 in america came with two different M20 engines.
The M20B27 was used in the 325E and was a detuned version of the M20B25. They make the engine stroke much longer but the heads were so small that it killed any horsepower.
So to Recap
E&F are Chassis Codes.
M,N,S are Engine Codes.
B is used after M,N,S to show displacement size.
TU stands for technical update for an engine. For Example BMW had the M52b28TU where they added variable valve timing to the exhaust valves on early e46s and later e39s, before they came out with the revised M54.
I know way too much shit about BMW.