as someone else already mentioned, if your luggage is checked right through, then you don't clear customs in LHR, but otherwise you do.
check with UA whether they will check luggage through on the other carrier.
I know that Air Canada has done it in the past when you had proof of a confirmed ticket (the itinerary must include the e-ticket number), AND if they had an inter-line agreement with the airline in question (so no charters for example).
Now if you mean, BA as in British Airways, then it's likely that they'll have an interline agreement with them, but if by BA you mean Berlin Air, then I would doubt it.