'Pull out the peg and the latch will fall' is the emblematic expression of Perrault's tale, first pronounced by the grandmother and then by the wolf who is a dressed as grandmother. Although it sounds like magic words, the sentence is only an invitation to cross the threshold, or even a down-to-earth description of how to open the door.
As for the Grimms, they don't use the formula. The grandmother says "Lift the latch", which has slightly less charm, and the wolf simply leaves the door open while waiting for the hooded little girl . Pragmatic.