The gemara has a discussion whether a son is allowed to serve as a go'el ha'dam. The conclusion of the gemara is that Reuven cannot serve as a go'el ha'dam to kill Yacov for murdering Shimon, because a son may not kill his father even as an agent of the beis din. But, the son of Yacov may avenge his father's killing, even if the murderer was Yitzchok - the father of Yacov.
There is a difficult Rambam (Hilchos Rotzei'ach 1:3) writes this din in the halachos of killing intentionally, not within the halachos of sho'geig -
האב שהרג את בנו, אם היה לנהרג בן הר"ז הורג אבי אביו מפני שהוא גואל, ואם אין לו בן אין אחד מן האחין נעשה גואל הדם להמית את אביו אלא בית דין ממיתין אותו, ואחד הזכר ואחד הנקבה בגאולת הדם
The Rambam records this din within the context of the go'el ha'dam serving as the agent of the court to carry out capital punishment to one who killed intentionally. Why does the Rambam not place this halacha within the section dealing with accidental killings, as it seems to be within our gemara? [See aruch la'ner who offers an elaborate explanation. Simply, the Rambam understood from the question that the gemara asked regarding the son serving as an agent for the court, that the entire context of the din is regarding the son serving as an agent of the court - not a freelancing go'el ha'dam].
Rashi explains that one may kill his grandfather because שהוא בן בנו של רוצח ואינו מוזהר על כבודו - "not obligated in the honor of a grandfather". This doesn't seem to be accurate because the Rama y.d. 240:24 paskens that one is obligated in the honor of their grandfather, just not as much as the honor of their father. The source of this is a Midrash that is quoted by Rashi in Chumash to explain the pesukim, indicating that the mitzvah to honor a grandfather is also m'doraysa. How can Rashi write here that one can serve as a go'el ha'dam to kill their grandfather because they aren't obligated to honor him? In truth, Rashi in our sugya is the source of the maharik who is quoted by the Rama that one isn't obligated to honor their grandfather (gr"a 33 and gilyon of r. shlomo eiger), but is rejected by the Rama in light of Rashi in chumash. How can we reconcile the contradiction in Rashi?
I would like to suggest that when one acts as a go'el ha'dam to avenge the blood of their relative, they are in essence honoring the deceased by avenging his blood. Therefore, when the deceased is his father, he has the right to kill his grandfather to avenge the blood of his father. Even according to Rashi in chumash that one has to honor their grandfather, the honor due to a father trumps the honor due to a grandfather. Rashi in our gemara is saying that one isn't commanded to honor his grandfather BECAUSE he is killing the grandfather to avenge the death of his father which is kavod to his father. It is for this reason that the braisa speaks in a case where he is killing the grandfather to avenge the blood of his father, and not a case where he is killing the grandfather to avenge the blood of his brother because to honor his brother he couldn't violate the honor due to his grandfather.
Perhaps the Rambam holds that if the grandfather killed the father accidentally, it wouldn't be such a kavod for the father to avenge his death by killing the grandfather since it was just an acciddent. That is why the Rambam records this din in the context of an intentional killing, where it would certainly be a kavod for the father to avenge his death by killing the grandfather who murdered intentionally.