Maximal Error-Detecting Capabilities of Formal Languages