Scottish brewer BrewDog has agreed to buy a small chain of UK pubs, adding to its on-premise reach.