Avoiding dairy - preventing climate change?

I have seen that in some carbon footprint questionnaires dairy (especially cheese) is considered as bad for the environment as beef. Is this true, and if yes, why it is so bad for climate?