The wood quality affects the kind of harmonics you get through the pickups, and the sustain.
Let's say you have a wire between two VERY hard posts. If you get the wire to vibrate, it might fo so for a long time. But if one of the post is made of plastic, the vibration will be shorter (that's a guitar's sustain) Then, if the post is very thin, the sound won't be very loud, if the post if hollow, and big, it'll sound much "larger", even though the wire vibrates in the same way... That's the quality of the wood.
Everyone's looking for the best wood possible (there's even a variety of woods called "tone woods") and some will pay great amount of money only for the look of a perfect AAAAA flametop on a les paul (what does it sound like? well, check out the flames on that one...)