If the brakes are squealing, there's a good chance it is the brake pad wear sensor. A new design was implemented in January 2006 and can be identified by its green color.
Car Problem Reports
BMW 525i New Brake Pad Wear Sensor Design Will Prevent Squealing
BMW 525i Problem
Model Year Affected: 2004