Frits Staal developed a theory of ritual in the late 1970s that is well-known to ritual studies scholars, though consistently misunderstood. Most attention has focused on Staal's claim that rituals are meaningless, since this seems contrary to most theories of ritual, and to professed beliefs of ritual practitioners. I show that Staal's treatment of meaning is more subtle than most readers allow, and I demonstrate that other theorists make similar claims, but my main focus is on another part of Staal's theory: the claim that rituals have the same formal structure, or syntax, as natural languages. Staal adapts to ritual an approach originally developed for language by Noam Chomsky, to the effect that ritual structure is sufficiently complex that it can only be modeled by what is known as a Context Sensitive Language. Seen in this light, Staal's theory is really a cognitive theory of ritual, in other words it is a theory of the mental qualities that are necessary for a person's actions to count as ritual actions. My final chapter therefore considers this theory in the light of recent, cognitive approaches to religion, especially the work of Dan Sperber and Pascal Boyer. Most work in the cognitive science of religion relies on methods from cognitive psychology, and Staal's theory is unique in presenting a computational model of ritual structure. It focuses our attention on the sequential ordering of the elementary actions that compose ritual sequences, and in the process it opens up a wide range of research programs for ethnologists and historians, as well as for ritual studies theorists. Staal's theory is based on data from the Vedic ritual tradition, especially the fieldwork he pursued on a performance of the Agnicayana in South India; in the process of examining Staal's theory, I consider a variety of topics relating to South Asian and Vedic ritual and grammatical theory, and I supplement this with a look at exempla from other ritual cultures. In addition to a thorough analysis and critique of Staal's theory, I provide the foundation for what I call a “distributional” study of ritual structure.