Thunder is produced by the explosive expansion of heated air surrounding a lightning channel.
Thunder can be heard from a maximum distance of about 10 miles (16 km) under good atmospheric conditions.
When lightning strikes close, thunder has a loud clap or snapping sound.
The rumbling we hear is the sound of thunder reaching us at different times from the sound produced along its length.

From: http://lightningsafety.com/nlsi_info/thunder2.html