As doc_study said, the bacteria (or fungus) would be eating the glucose for energy, and the virus wouldn't, so the glucose would be low in bacterial or fungal meningitis but normal in viral meningitis - this is one of the key diagnostic features of the CSF tap.
Protein could be normal or elevated in viral meningitis. As doc_study said, inflammation will raise levels. Protein will especially be raised in bacterial or fungal meningitis - I think of it as the presence of antibodies, though I'm not sure if that's accurate.
And as patelMD, pointed out the Bacterial meningitis would cause a non specific acute Inflammatory response. May be more protein in the bacterial meningitis is due to more severe inflammation of the meninges, compromising the BBB.
In case of the Viral meningitis, we have a low cell counts because only Lymphocytes are recruited to start a Cell mediated response.
Glucose is consumed by both the Bacteria & WBCs. So, more fall in CSF glucose in the Bacterial Meningitis.