Yep.
For pouring boiling oil, offal, privy products, rotten bodies and other unsavories down onto the folks trying to bust through the door below.
I wouldn't have a ground floor entrance at all. The door would be at the top of a narrow stairway clinging to the lower wall, with a small landing and no railings.
That Rick Steves travelogue on PBS showed this technique was used for private homes in some European town or other --Venice? Not too practical for a castle or fortified town where horse-drawn supplies have to be carted in and out in normal times.