Why is carbon so rare on the Moon and on Mars? Carbon is the fourth most common element in the universe and in the Solar system. It is about the ninth most common element in Earth's crust. It doesn't seem to be part of any of the ten most common compounds in the Earth's crust. 

So where is all the carbon hiding?
Why isn't it more common in planetary and lunar crusts?

Is it maybe mostly occurring in volatiles together with hydrogen and oxygen, and has left bodies which lack atmosphere or freezing temperatures? Is it primarily biological processes which binds carbon to solid molecules? Having a look around on Earth's natural surface today, there's lots of solid carbon compounds everywhere, so the contrast is interesting.
There is not much doubt that the abundance of carbon in the protosolar nebula was not abnormal. We can tell that by looking at the carbon abundance in the atmosphere of the Sun - it has an abundance of 8.43 on a logarithmic (base 10) scale where hydrogen has an abundance of 12 (Asplund et al. 2009). This is typical for stars in the solar neighbourhood.

However carbon in the solids of the solar system - i.e. in the Earth, moon, meteorites etc. is underabundant with respect to this by something like a factor of 10. Nitrogen is similarly underabundant in the Earth and oxygen to a lesser extent (a factor of two). (Lodders et al. 2009)

The reason for this is that C,N,O are all capable of remaining in the gaseous phase at the kinds of condensation temperatures that are typical for forming most of the "rocks" that make up the Earth and other solids in the solar system. In particular, carbon monoxide is readily formed at high temperatures and cannot easily be captured into terrestrial planets and other rocky materials.