When you want to grab a creature or wrestle with it, you can use the Attack action to make a special melee attack, a grapple. If you're able to make multiple attacks with the Attack action, this attack replaces one of them. The target of your grapple must be no more than one size larger than you, and it must be within your reach.
Using at least one free hand, you try to seize the target by making a grapple check, a Strength (Athletics) check contested by the target's Strength (Athletics) or Dexterity (Acrobatics) check (the target chooses the ability to use). If you succeed, you subject the target to the grappled condition (see appendix A). The condition specifies the things that end it, and you can release the target whenever you like (no action required).
Escaping a Grapple.
A grappled creature can use its action to escape. To do so, it must succeed on a Strength (Athletics) or Dexterity (Acrobatics) check contested by your Strength (Athletics) check.
Moving a Grappled Creature.
When you move, you can drag or carry the grappled creature with you, but your speed is halved, unless the creature is two or more sizes smaller than you.
Is escaping a grapple a single attack (part of the attack action) or a separate action?
It says very clearly that while attacking, if a player can grapple someone with an attack action, and if they have multiple attacks with the Attack action, this [grappling] attack replaces one of them. Shouldn't it be the case that escaping a grapple could also be one of those "multiple attacks?" I can't see the distinction with ruling it otherwise.