a manual of magic or witchcraft used by witches and sorcerers.

1850–60;  < French,  alteration of grammaire  ‘grammar’ < Old French gramaire;  see grammar that may contain spells, conjurations, instructions for divination and the construction of amulets, and other secret knowledge of a supernatural kind. The examples include such famous works as the Sixth and Seventh Books of Moses, The Book of St Cyprian, The Key of Solomon and The Sacred Magic of Abramelin the Mage.

The word is French, in the same sense. It began to appear in French-English dictionaries early in the nineteenth century but became more widely known in the 1850s. In French, it was a medieval modification of grammaire, a book of grammar, by which was meant Latin grammar, since at the time there was no other kind. It derives from the Latin grammatica, the study of literature in general, which by the Middle Ages had come to mean knowledge of Latin.

The shift from book of grammar to book of magic isn’t as weird as it might seem. Few among the ordinary people in those times could read or write. For superstitious minds books were troubling objects. Who knew what awful information was locked up in them? For many people grammar meant the same thing as learning, and everybody knew that learning included astrology and other occult arts.

In medieval English, grammarye was likewise the study of Latin grammar and this, too, took on undertones of occult learning, magic and necromancy. It fell out of use but was revived by Sir Walter Scott in his Lay of the Last Minstrel in 1805.

Another of Scott’s popularisations was the Scots glamour. This was also from grammar, with a small shift in pronunciation, and shared the idea that grammar was linked with witchcraft and sorcery. To us today glamour is physical allure but for the Scots of earlier times, and for Scott, it was enchantment, magic or a spell cast upon a person.