Yes, this is grammatical. The first noun is acting like an adjective. As Colin notes, you can't always put a noun in a the same position as an adjective bu it does work as 'N N'.
'Cheese casserole' isn't a casserole that happens to have a lot of cheese (which is what is implied by 'cheesy casserole'); somehow 'cheese ' is essential to the casserole that is a 'cheese casserole'.
The official term for this usage of a noun as a modifier is Noun Adjunct.
It is not an Adjectival Noun which is the other direction, an adjective that acts like a noun.