The 32-year-old, Scotland's fourth most capped player with 71 caps, has spent the last seven seasons with Newcastle, where he notched up 120 appearances and scored an impressive 15 tries for the English Premiership side.
Grimes said: "Moving to the Borders is hugely exciting for me because I will be hooking up with coaches that know me and who I've played with before.
"I worked with (head coach) Steve (Bates) at Newcastle and I played for Scotland with Alan Tait and George Graham so the relationship I have with the coaches is already very strong.
"The Borders is a young and ambitious side and have made huge improvements in their performances last season so hopefully I can make a big contribution to the club and Borders rugby.
"My main focus for the coming seasons will be the Celtic League, which I've never played in before, and travelling to Wales and Ireland for away games will definitely keep me on my toes.
"Also, with competition for places in the Scotland squad becoming increasingly tough, it would be an added honour for me if I could make a return to the Scotland team for next year's Rugby World Cup in France.
"That aside, I'm just really looking forward to returning to Scotland and being a part of Scottish rugby once again."
Bates added: "From our point of view, we are incredibly fortunate to have signed a player of Stuart's undoubted international quality and experience and we are really looking forward to his contribution both on and off the field."