The "code" is for securing the car from being started/taken by someone that has excess to a working key.
For instance, if your relationship with a significant other is nearing its end...and you know that they know that your BMW is precious to you and that if they can somehow take it, or do something dastardly to it...you'd be truly hurt by it. Well, you can set a "code" (any number of your choosing between 0000-9999) and unless they can figure it out within 3 tries...the car won't start even though they may have access to your keys.
This can also be used if you have a rebelling teenager in your home that may be prone to sneaking out of the house, putting your BMW in neutral...then rolling it down the drive before starting it...as they gallivant around town during the middle of the night.
Another scenario may be if you have a family member that has addiction problems and may be prone to taking your car without asking...you can set a "code" to prevent them from being able to take the vehicle if they somehow get access to your keys.
A fourth and final example...you can prevent parking attendents from starting/moving/driving your vehicle if you are using a parking lot where you turn your keys in to an attendent..you can set a code prior to turning in your keys...and they won't be able to move/start your vehicle (make sure that you're not blocking anyone in case they need to move your vehicle to let someone out).
The "code" feature is one step further than the normal EWS system. EWS prevents anyone without a key from being able to start the car...the OBC "code" feature carries it further and prevents someone WITH a key from being able to start the car. Of course, you have to have the HIGH OBC which means either the Nav option...or the HIGH MID and HIGH instrument cluster. If you have the low MID & low instrument cluster...you don't have this feature:
Navigation instructions explained in the owners manual:
MID instructions explained in the owner manual: