In football, grounding refers to two different things:
This is a penalty called when a passer, usually the quarterback, throws the ball forward without a realistic chance of completion to avoid a sack or loss of yardage. In simpler terms, it's when the quarterback throws the ball away to avoid getting tackled, but no receiver in the area could reasonably catch it. This is a 10-yard penalty and a loss of down for the offense.
Here are the key elements of intentional grounding:
The passer is facing imminent pressure from the defense.
The passer throws the ball forward.
There is no eligible receiver in the vicinity of the pass with a realistic chance of catching it.
The ball lands at or beyond the line of scrimmage (even if it goes out of bounds).
Grounding the ball
This is simply the act of the ball carrier, usually the quarterback, bringing the ball to the ground to end the play. This can be done by kneeling, sliding, or spiking the ball. Grounding the ball does not incur any penalty as long as it's done within the rules.
For example, a quarterback who kneels on the ground to run out the clock at the end of the game is grounding the ball. Similarly, a quarterback who slides to avoid a tackler and then throws the ball to the ground is also grounding the ball.