Ibn Abbas said regarding the grandfather, "As for the one to whom the Messenger of Allah ﷺ said, 'Had I taken anyone from this nation as a close friend, I would have taken him,' he ruled that the grandfather is treated as a father," meaning Abu Bakr.
حدثنا إسماعيل أنبأنا أيوب
قال ابن عباس في الجد أما الذي قال له رسول الله ﷺ لو كنت متخذا من هذه الأمة خليلا لاتخذته فإنه قضاه أبا يعني أبا بكر
Its isnad is sahih. Bukhari narrated it 12:17 through Abdul-Warith from Ayub. Bayhaqi narrated it 6:246 through Wahib from Ayub. See also 2422 and 3580.What is meant by this hadith is that Abu Bakr ruled that the grandfather takes the place of the father in inheritance when the father is absent, so he inherits what the father would have inherited, and he excludes full brothers and paternal half-brothers from inheriting. See the details of this in Fath al-Bari 12:15–19.