There are a few correct answers here, and others aren't so correct...
Scratching is when a gymnast does not compete one event, or even all of the events at a competition. This is most common when a gymnast gets injured, so it is a "spur of the moment decision." Gymnasts do enter a competition knowing that they are not going to compete one, or multiple events.
In most cases, the gymnast salutes in, touches the piece of equipment with one hand (or steps on the floor if they are on floor ex), then salutes out to complete their exercise. If they did not compete any events, and are not planning on competing (were injured prior to the competition) they do not need to salute in and out on each event.
In the olympics, there are girls who do not compete every event, but they do not complete a "formal" scratch on each event. They inform the judges and others in charge of the meet ahead of time.
At these upcoming olympics, they are only going to be allowed 3 gymnasts per event in the team finals, and all three scores must be counted toward the final team score, so there will be gymnasts who will compete all events, and there will be others who only compete one event (and combinations in between). Each country will choose the best on each event from their team of 6 gymnasts, with three competing and three sitting out the event. The three gymnasts not competing on a particular event will not be required to scratch.