The principle behind thunder is actually really closely related to lightning processes. If you're familiar with basic circuit principles, that's a really good way to explain it. (I'm an electrical engineering student.) What happens is this: Lightning occurs when two "masses" of opposite charge are connected by a path through air. When that happens, the result is similar to the behavior of a capacitor. When you touch the two leads of a charged cap together, the cap dumps the charge. The same thing happens with the charge "masses". The important thing with caps though, is their governing relationship, which states that the faster the voltage between the two charge "masses" changes (drops, in this case), the more current flows, which makes sense, because current is just quantity of charge per second.
When current passes though any medium, it sheds power as heat. In this case, it sheds its heat so fast though, that it superheats the air to a plasma, causing a rapid expansion, followed by a cooling contraction. That sudden pressure change is what you hear as thunder. The more current that gets dumped in a lightning strike, the sharper the crack. Next time there's a storm, pay attention to the flash duration. Generally, longer flashes are slower current dumps, which yield a long, low rumble. Fast flashes are fast dumps, which give you a sharper crack.
Hope that helps.