The 29-year-old was without a club after leaving St Johnstone in January and Bees boss Edgar Davids moved to bolster his attacking options.
Beattie, a former Scotland international, joined Celtic after being released by boyhood club Rangers, and scored 16 goals in 65 appearances for the Parkhead club.
He was then signed by West Brom for a reported £1.25m, where he netted seven times in 41 games but struggled to become a regular starter.
Loan spells at Preston, Crystal Palace and Sheffield United followed, before he joined Swansea.
He spent two and a half years in Wales - including a brief spell on loan at Watford - prior to moving back to Scotland to join Hearts last February.
After nine appearances for the Edinburgh club, Beattie joined St Johnstone but had his contract terminated by mutual consent last month.