It's exactly the the same engine but there is a tradeoff for the performance. The one with more horse power will generally either have less fuel efficiency or produce more emissions.
Eh, I'd assume different pistons and camshafts, but googling doesn't return any definitive answers. Could be wrong. Maybe I'm giving BMW too much credit.