This happened to me once. I had renewed my passport between booking the flight and actually flying. It turned out that the booking in BA's systems had not acknowledged the updated passport details I subsequently entered and recorded a mismatch between the old passport details and the new passport. It was fixed at check-in.