Grammars of Formal Uncertainty: When to Trust LLMs in Automated Reasoning Tasks