In John 14:26 the Greek noun is παράκλητος (paraklētos), from two root words, "para" = to be beside; and "kletos" = a calling to come. Thus, a parakleos was one who is called to be beside someone. The word is used of a lawyer who helped someone in legal battles. Thus, it is translated: an advocate, intercessor, a consoler, comforter, helper, intercessor, consoler, etc.
In Matt 5:4, the Greek verb is παρακαλέω (parakaleó), in this instance, the verb is in the Future Indicative Passive - 3rd Person Plural.
The two words, παράκλητος (paraklētos) and παρακαλέω (parakaleó) are cognate relatives from the same Greek stem. Thus, there is a definite linguistic connection as Ellicott observes for Matt 5:4:
They shall be comforted.--The pronoun is emphatic. The promise implies
the special comfort (including counsel) which the mourner needs;
"comforted" he shall be with the sense of pardon and peace, of
restored purity and freedom. We cannot separate the promise from the
word which Christendom has chosen (we need not now discuss its
accuracy) to express the work of the Holy Ghost the Comforter, still
less from the yearning expectation that then prevailed among such of
our Lord's hearers as were looking for the "consolation"--i.e., the
"comfort"--of Israel (Luke 2:25).