OSMesa is the API exposing Mesa's off-screen rendering capabilities. The off-screen rendering infrastructure isn't dependent upon any specific operating system windowing system, or graphics hardware. OSMesa rendering is simply done in user-space with main system memory. An example use-case all along for OSMesa has been "to use Mesa as an off-line, batch-style renderer."
Up until now OSMesa has just been exposed through some simple demos bundled within the Mesa source tree, but now Brian Paul has made OSMesa into a Gallium3D state tracker that can be used by LLVMpipe and Softpipe. So in effect it's the Gallium3D software fallback drivers being able to do off-screen rendering to this OS-independent windowing-system-independent hardware-independent interface.
The Gallium3D OSMesa state tracker is just over 800 lines of code plus there's a few other Mesa patches to make this work by Brain turn out nicely. Brian acknowledges though, "The OSMesa interface is pretty old and ugly but I think most OSMesa users would rather not have to port their apps to a new interface."
Those interested in seeing the OSMesa Gallium3D patches until being merged can find them on the mesa-dev list.