Formal Program Specifications as Semantic Probes for Code Comprehension Evaluation in LLMs