The Core Audio subsystem of Mac OS X is very powerful beast. It deals with sound in floating point arithmetics lifting the limits on resolution. The Audio Toolbox allows for plug-ins on the system level. Also, software mixing has been on Mac OS for more than a decade (and still surprises Windows and UNIX users: you can play sound with two programs at the same time? — yawn), but OS X makes this even more flexible eventually circumventing tools like RealPlayer and the QuickTime PlugIn which do not allow you to save the audio streams you receive with these tools.
What it does is simple: WireTap writes the output of the current sound output port to a file. You can choose from the available QuickTime compressions (unfortunately, Apple still does not provide MP3 compression on system level, only in iTunes). This works for every application, even DVD and browser plug-ins [via Der Schockwellenreiter]
Rogue Amoeba provides a bunch of shareware tools targetting the same area and adding extra value: Audio Hijack and Audio HiJack Pro are the more sophisticated version of WireTap. Detour allows to set the output volume depending on the source of the audio.