Gripe water is a "medicine" used to treat colic in infants. To be clear, there is no scientific evidence that it works, and some variants may contain activity harmful substances. To be very very clear the original formulation, below, is just pain bad, and currently illegal in both the US and the UK.
Gripe water is not a traditional remedy, despite what many sources would have you believe. It was invented in 1851 by English pharmacist William Woodward, who noted that certain medications given to patients to treat fen fever and malaria also had the side effect of treating colicky babies. Broadly speaking, today colic simply refers to frequent idiopathic and inconsolable crying, but back in the day people assumed that was due to intestinal gas, and cures focused on helping with the digestive process.