Meditation is a training of intentionality. The purpose is to improve one's ability at deliberately steering intentions in a beneficial and wholesome direction, while refraining from unwholesome and potentially harmful actions.
This is done starting from the more apparent domain of bodily and verbal behaviors, and thus by establishing a degree of right conduct or morality (for instance, by making a commitment to refrain from certain actions).
But the purpose of meditation is to go deeper and tackle intentionality at its root, in the domain of thought processes. This is done by exploring the ways in which attention (which is a form of intentionality) works. For instance, by establishing the intention of observing one's bodily posture, one can then play with different ways of paying attention to it.
A crucial aspect of meditation consists in applying suitable conceptual schemes to analyze experience. A very helpful one entails the ability of discerning between three basic ingredients: perceptions (the perception of the body, for instance), feelings (a sense of pleasantness, unpleasantness or neutrality associated with that perception), and intentions or (co)actions (any reactions towards how one feels).
As one tries to observe these elements, it will become apparent that there are a number of other pushes and pulls that drag attention away. Exploring how this mechanism works is where actual practice really begins.