I'm sure it's been stated already, but it's worth reiterating: They can erupt in a fireball when smashed and a spark ignites the expanding gasoline and the surface area of the gasoline molecules. The environment inside a gas tank is largely and mostly fuel vapor, lacking the oxygen to create a true explosion. But if you were to introduce fresh air at (I THIN) a ratio of 13 to 1, that is 13 times the volume of flammable vapor with atmosphere. I say atmosphere because atmosphere is largely nitrogen. But if the conditions are right - whether in a Pinto or a jet liner - the gas tank can explode. But there's a difference between explosion and eruption. Shooting a fuel tank with a bullet won't cause the tank to explode. Shooting it with a tracer round will also not result in an explosion. However, IF the tank has the right air to fuel ratio then in that case - yes, it WILL explode.
Many things can be flammable, combustable or can explode. In the case of a stick of dynamite - it has its own oxidizers. When lit it will violently expand in what is classified as any explosion. Gasoline does not contain an oxidizer, so it must depend on two things - the fuel to be in vapor form AND oxygen to be present in the proper ratio.
Grain silo's have been known to explode. Not because grain is explosive, no - it doesn't have an oxidizer. It's the airborne dust that can burn rapidly, thus produce an expanding envelop of heat energy. One dust particle surrounded by atmosphere can ignite. It then ignites adjacent particles. It's exponential, like one particle igniting (guessing at this factoid) 20 more particle adjacent to the initial point of ignition. Those 20 (remember, I'm just guessing at how many particles may be adjacent to a single particle) but those 20 then ignite a hundred or more adjacent particles in a rapid fireball. The resulting heat expansion produces the grain silo explosion that has been experienced in the past. A factory with office space had a dust explosion. A source of ignition ignited a particle or some particles and the resulting eruption of flame and heat shook more dust loose and propagated the process throughout the building, lifting the entire roof off the building.
The fundamental point I'm making is that there are different types of explosions, eruptions and combustion. For a gas tank on a car to explode - unless some fool has charged the tank with oxygen - no - it won't explode. It will burn. But it won't explode. Stuffing a rag soaked in gasoline into the filler neck will not result in the car exploding. However, the heat can cause the tank to boil (vaporizing fuel), causing the tank to rupture. That vapor mixes with atmosphere and WOOSH! You get a rapid expansion of fuel/oxygen/heat - the three sides of the fire triangle. It may blow out the windows, may even lift the trunk off the car, but it's not an explosion.