Just like most auto manufacturer's, BMW has codes corresponding to the various model designs. Within each model code, there may be many variations. However, all those variations will share many of the same parts and characteristics.
For instance, within the 3 Series lineup, there may be 325, 328, 330, M3 - and various sub categories therein - 2 door, 4 door, convertable, etc... All those models within a span of production years (typically 7 years for BMW) will share one model code.
BMW uses the German word Entwicklung (Development in English) followed by a number, to designate a model type. These codes are known as E Codes. Each E Code is assigned by BMW at the inception of each new model's development, not at time of release.
Due to the relative ease and uniformity of this identification system, enthusiasts, tuners, and mechanics quickly adopted the use of E codes when discussing BMWs. This system makes it easy to quickly identify parts, tools, or any model-specific details that may be at issue.
As mentioned above, BMW typically revises their models every 7 years. This gives aftermarket companies and mechanics a great advantage, as many items they sell and use will be universal for 7 years worth of production cars.
Finally, here is a list of BMW's E Codes to date: