What's the grammar behind this sentence? I'm struggling to figure out how it works.
It's an expression. (or rather a collocation)
Co to za zapach/kolor/hałas? = What is that smell/colour/noise? etc.
The full sentence may be: 'Co to jest za dźwięk?'. 'Co' is an interrogative pronoun meaning 'what', and 'Co to za ...?' is a fixed expression that would translate to 'What kind of ... is this?'.