Actually if possible you should get out of your car before the lightning begins and get to a much better shelter during a lightning storm.
But if you're unable to get out of your car and reach more suitable shelter during the lightning storm then the reason you should stay in your car during the lightning storm is due to the car acting as a Faraday cage which protects you from getting shocked and struck by the lightning.
Your cars tires will also insulate you from the ground contact where the lightning will travel too.
Remember that electricity takes the path to least resistance and will go anyway it wants to so it will reach the ground.
Just be sure to not touch anything metal inside your car or other vehicle to prevent getting struck by lightning inside the car.
Once again although a car can somewhat protect you from getting struck by lightning it would be in your best interest and for your safety to get into a building or your home before the lightning storm gets too bad or before it begins to be safer.