Folktales - the popular oral folk narrative of non-fiction stories - were violent, sexual, and NOT for children. They were also extremely long; many could last several nights in the telling. Perrault digested this form of adult oral narrative and recast it for children - as did the Brothers Grimm - but the core nature of the narrative remains with its violence and, as you say, "grim" nature. Andersen wrote fiction inspired by but not drawing as directly on folklore, but he, too, could not get away from the flavor of the material that inspired him.
The following is an excerpt from my Introduction to Folklore that may help; feel free to ask questions:
A word here about the term “fairytale” is appropriate. At the end of the eighteenth century, various writers, most prominently the Grimm brothers, began publishing children’s stories based on folktales. These collections became extremely popular, particularly among the urban and increasingly literate emerging middle class as it found itself removed from the peasant soil that served as home to the stories. Fairytales often cause misunderstandings. In a culture that knows more about fairytales than Märchen, people assume that the folktale was intended for children. This is certainly not the case since the stories were often violent or sexual in ways thought inappropriate for children. Indeed, the telling of a folktale was usually delayed until the children had gone to bed. While fairytales provide the modern reader with the easiest access to the many stories that were once told internationally, one should always realize that they are removed from the primary inspiration. The original stories and their content provided serious entertainment for adults and they were part of an oral tradition, not something that was fossilized in writing.
The evolution of published fairytales had a profound effect on the subject of fairies, elves, trolls, and similar entities. Because fairytales became the literary domain of children, many people – including later writers – assumed the same was true of the supernatural beings. In their original context, nothing could be further from the truth. These were not cute, diminutive creatures whose sole purpose was to delight children. They were powerful, dangerous, and capable of great harm. The European peasantry feared and respected them, and their stories underscore this, conveying in uncompromising terms the code of ethics and behavior that one must employ to survive an encounter with the dangerous world of magic and power.
The definition proposed here for “fairytale” does not necessarily coincide with how people – and even some folklorists – use the term. Some scholars regard “fairytale” as appropriate for the more fantastic expressions of folktales as they were told by the folk. The reason why the term is not used in that capacity here is because the folk did not refer to these stories as fairytales and because the term implies a degree of innocence that is inappropriate; again, “fairytale” is most suitably reserved for the published children stories that gave literary expression to the adult oral fictions of the folk.