At higher wind speeds, the speed shown is the maximum expected gust.
It changes over when the maximum expected gust is 40 mph (not knots). You can tell the difference because average wind speeds have a white background, and gusts have a black background. I tried to post example screenshots, but I couldn't find any location with a >40mph forecast today ;-)
There is a little bit of explanation about half way down this page: https://www.bbc.com/weather/about/17185651