Your 2002 BMW M3 could have high HC problems for many reasons. You should check first that the engine is in proper fuel control. A rich fuel mixture or lean fuel mixture can cause high HC. Hydrocarbon (HC) is basically raw fuel, otherwise known as gasoline. The main reasons vehicles fail for high HC is defective spark delivery.
However in cases where spark (ignition) is not the problem you want to look into lean or rich fuel conditions. Check your BMW's CO results too. you'll find this on the VIR (vehicle inspection report). If the CO is 0.00 or lower than the state average, you may suspect a lean fuel problem. in this case you'll need to inspect thing s which would cause inadequate fuel delivery; defective MAF (mass air flow) sensor, TPS (throttle position sensor), and/or oxygen sensor/s.
Look into the flow chart at the following link for HC and CO failures:
http://www.smogtips.com/failed-emissions-test.cfm