The Mahābhāṣya (Sanskrit: महाभाष्य, IPA: [məɦɑːbʱɑːʂjə], great commentary), attributed to Patañjali, is a commentary on selected rules of Sanskrit grammar from Pāṇini's treatise, the Ashtadhyayi, as well as Kātyāyana's Varttika, an elaboration of Pāṇini's grammar. It is dated to the 4th century BCE. 
Patañjali is one of the three most famous Sanskrit grammarians of ancient India, other two being Pāṇini and Kātyayana who preceded Patañjali (dated to c. 150 BCE). Kātyayana's work (nearly 1500 vārtikas on Pāṇini) is available only through references in Patañjali's work.
It was with Patañjali that the Indian tradition of language scholarship reached its definite form. The system thus established is extremely detailed as to shiksha (phonology, including accent) and vyakarana (grammar and morphology). Syntax is scarcely touched, because syntax is not important in this highly inflexional language, but nirukta (etymology) is discussed, and these etymologies naturally lead to semantic explanations. People interpret his work to be a defense of Pāṇini, whose Sutras are elaborated meaningfully. Patañjali also examines Kātyāyana rather severely. But the main contributions of Patañjali lies in the treatment of the principles of grammar enunciated by him.
Kātyayana introduced semantic discourse into grammar, which was further elaborated by Patañjali to such an extent that Mahābhāṣya can be called a mix of grammar as such as well as a philosophy of grammar. Kāśika-vritti by Jayāditya and Vāmana (mentioned by Itsing) included viewpoints of other grammarians also which did nor conform to Patañjali's views. Many commentaries on Mahābhāṣya were written, of which Kaiyaṭa's commentary named Pradīpa (c. 11th century CE) is most celebrated.
After Kaiyaṭa, interest in the study of Sanskrit grammar according to traditional Pāṇinian sequence of sūtras started declining, and a new simplified system gained ground which was started by Buddhist scholar Dharmakirti through his commentary on Pāṇini named Rūpāvatāra, which excluded Vedic sūtras of Pāṇini in which Dharmakīrti had no interest and dealt with only 2664 sutras.
James R. Ballantyne (1813–1864) published the first part of the Mahābhāṣya of Patañjali in 1856, for the first time opening native Indian grammatical tradition to a wider European scholarly audience.
Story behind Mahabhashya
A certain legend about the Mahabhashya is as follows. Patanjali is an incarnation of Adishesha who was blessed by Lord Shiva enabling him to write Mahabhashya. After he incinerates the 999 disciples in anger due to the misbehavior of one in leaving the class without his permission, he turns the last student also into ashes. It is through an Yaksha that he decides to spread his knowledge since the Yaksha was eavesdropping the classes. He curses the Yaksha into a Brahmarakshas, promising his revival only upon teaching a human, the Mahabhashya.The Yaksha teaches it to Govindaswami, the father of Vararuchi, Vikramaditya, Bhatti and Bhartruhari.
- K. Kunjunni Raja. "Philosophical elements in Patañjali's Mahābhāṣya". In Harold G. Coward, K. Kunjunni Raja. Encyclopedia of Indian philosophies. 5 (The Philosophy of the Grammarians). Motilal Banarsidass Publ. p. 115. ISBN 81-208-0426-0.
- 4th century B.C.http://dsal.uchicago.edu/reference/gazetteer/pager.html?objectid=DS405.1.I34_V02_298.gif
- The Mahābhāṣya of Patañjali with annotation (Ahnikas I–IV), Translated by Surendranath Dasgupta, Published by Indian Council of Philosophical Research
- Mahābhāṣya of Patañjali (Śrīmadbhagavat-patañjali-muni-viracitaṃ Pātañjalaṃ Mahābhāṣyam) by Patañjali (in Sanskrit), Publisher: Vārāṇasī : Vāṇīvilāsa Prakāśana, 1987-1988., OCLC: 20995237
- Bronkhorst, Johannes, 1992. Pāṇini's View of Meaning and its Western Counterpart. In, Maxim Stamenov (ed.) Current Advances in Semantic Theory. Amsterdam: J. Benjamins. (455-64)
- Scharfe, Hartmut, 1977. Grammatical Literature. Vol. V, Fasc. 2, History of Indian Literature, (ed.) Jan Gonda. Wiesbaden: Otto Harrassowitz.
- Staal, J.F. (ed.), 1985. A Reader on Sanskrit Grammarians. Delhi: Motilal Banarasidass.