Every price an airline sells is a named fare, and the fare basis code is the name. It points to the fare's rules: whether changes are allowed and what they cost, whether any money comes back on cancellation, minimum and maximum stays, and which flights it can be combined with.
The first letter is almost always the booking class the seat was sold in. The rest is the airline's own shorthand, and it often follows loose conventions, such as H or L for high or low season, or W and X for weekend and weekday travel. Treat those as hints, not rules: each airline writes its own codes, and the same letters can mean different things at two airlines.
Two passengers in the same cabin on the same flight can be on different fare basis codes, which is how the person in the next seat paid half as much, or twice. A return can also have a different code for each direction. The code is worth knowing when comparing two prices that look identical, checking what a fare allows before buying, or reading a fare rule an agent quotes back to you.
BA0117 · 23NOV · LHR–JFK · Class Q · Fare basis QLX7C3
Where you'll find it
On the e-ticket itinerary receipt, in a column labelled fare basis or FBC beside each flight. Booking sites rarely show it; the airline's receipt or a travel agent will.