'But' is a coordinating conjunction used to connect two independent clauses or ideas that contrast with each other. It plays a crucial role in compound sentences, allowing writers to present opposing thoughts and create a nuanced narrative. The use of 'but' indicates a shift in direction or tone, often highlighting a conflict or exception within the context of the statements it connects.