These are the steps you need to follow in order to program remote Diamond Shaped Key on the BMW cars.
       These type of keys remote was used on BMW E46, E39, X3, X5 and others produced from 1999.
       OEM Part Number of keys : KR55WK47993 and others.

     BMW remote key fob programming guide - instruction

1. Open central locking system ( ZV ) using the car key. You must initiate the central locking system first.
2. Get into the car and close all doors. 
3. Using the car key, switch the ignition lock briefly to ignition lock position 1 and switch off again.
    The switching time must remain under 5 seconds, otherwise the system is not ready for initialization.

    You must insert & turn the key to ignition switch position 1 ( not position 2 )
4. At the radio transmitter : Press button #2 and hold in.
    You must then remove the key from the ignition and press & hold button #2 within 5 seconds of removal.
5. Press button #1 three times ( in a space of 10 seconds ). Button #2 must remain held in.
    You then have up to 10 seconds to press the Roundel button THREE times ( while still holding down button #2 ).
6. Relase button #2
7. The ZV signals by means of "Locking" and immediate "Unlocking" that a radio transmitter has been
    successfully initialized.

 If you have any additional remote keys - you start their programming on STEP 4
 Do not insert any additional remote key into the ignition switch - if you do - the 1st key will lose it's programming.

 If the ZV does not send a return signal, initialization bust be restarted. Once the first initialization process has been completed,  
 another three radio transmitters can be initialized. For every radio transmitter, the procedure described under 4 above must
 be repeated within 30 seconds, otherwise initialization stand-by is switched off. During initialization, all other existing radio
 transmitters must be initialized. The ignition lock must never be reactivated during the initialization process. If this were to
 hapen, then all radio transmitters would have to be re-initialized.

 Alternate procedure if above doesn't work or if you do not have a working remote :

 1. Turn key to position 1 five times very quickly
 2. Remove key
 3. Hold unlock button then press lock button 3 times, release unlock button.
 4. If you have another key do the same button pressing within 30 seconds
 5. Turn on ignition to finalize

 Alternate procedure 2 :

 1. With both keys, get in the car and close all windows and doors.
 2. Put working key into the ignition and turn to position 1 ( the accessories should turn on )
 3. Turn the key back to position 0 and take the key out of the ignition.
 4. Using the working key, hold down the unlock button, press the BMW logo (lock button) 3 times, and release
     the unlock button. Doors should lock and unlock.
 5. With the new key, hold down the unlock button and press the BMW logo (lock button) 3 times and let go of
     the unlock button. Doors should lock and unlock and you're done.