It's used to introduce a contrasting or surprising element after describing something as boring. For example:
* "Le film était ennuyeux mais la fin était surprenante." (The movie was boring but the ending was surprising.)
* "Son cours est ennuyeux mais il est un excellent professeur." (His class is boring but he is an excellent teacher.)
It emphasizes the contrasting aspect by highlighting the "but" element.