Pine tar is a sticky substance extracted from the sap of fir trees. It is used by batters to improve their grip on the handle of the bat, but a rule explicitly bans it from being smeared higher than a certain limit, to avoid it coming into contact with a pitched ball. A dispute over the interpretation of this rule led to the famous Pine Tar Game in 1983.
Pine tar is one of the substances that is sometimes illicitly used by pitchers to improve their grip or to doctor the ball. That particular use is illegal and has led to pitchers being ejected from the game for having pine tar somewhere on their person. For example, Joel Peralta was caught with pine tar on his glove in 2012 and was immediately ejected by umpire Tim Tschida and suspended. The legal way for pitchers to improve their grip is to use the rosin bag, whose use does not affect the flight of the pitch.