。
Grandpa just barely managed to escape.
Literal
Grandpa [topic-は] barely [with-のことで] escaped.
爺ちゃん is affectionate/familiar for grandfather (~ちゃん is the diminutive/endearment suffix). やっとのことで is a set idiom literally 'by the act of (just barely making it),' meaning 'just barely, with great difficulty, at last.' The 脱出する ('escape, break out') is a formal verb contrasting with the colloquial register of 爺ちゃん.