Castrol Edge for M-Engines is supposed to be for all M engines except the V8s, whereas Castrol TWS is supposed to be for the V8 in the M5 & Z8.
They've both got accreditation for the M engines, so you'd probably be fine with both - and you'd be fine with most other manufacturer's oil of the same quality.
BMW's recommendation is just that - a recommendation - they can't void your warranty (if you have one) for using a different/cheaper oil that has the right spec. No different to their recommendation to use run-flats on non-M's and Continental SportContact M3 on Z4Ms - when we all know there's better tyres out there.
However, you may find it's simply their computer system that lists it as such, as I've had invoices for services at dealerships where it's shown SLX, TWS, or something completely different.
Ask them to show you a top-up bottle from the parts department, and see what's on the bottle. Although that doesn't necessarily mean that's what they put in the car.