Those whom this passage is referring to are the martyrs who were killed along with the imam in Karbala, the reason being:
1) Usually, live people who visit the shrines of the imams aren't referred to as ‘Arwah’ (souls).
2) This passage is read by the pilgrim himself, so he can't be the one being addressed by it at the same time.
3) In all of the ziyarats of Imam Husein (as), never have the pilgrims of his shrine been specifically greeted with salam.
4) The ziyarat was created before Karbala became a place where people other than the imam (as) and his companions were buried, so the passage can't be addressing all of those who have been buried there till today.
5) From the context clues in this ziyarat, it is concluded that the passage is addressing the martyrs who accompanied Imam Husein (as) in Karbala. Just like how in another part of the ziyarat the companions of the imam (as) have been greeted specifically and directly: “السلام علی الحسین و علی علِیّ بن الحسین و علی اولاد الحسین و علی اصحاب الحسین”. Add to that the fact that the theme of this ziyarat in general, is to send salams to Imam Husein (as), his children, and his companions and to pronounce one’s loyalty and friendship to him and one’s hate for his enemies.
6) In another variation of this ziyarat, it reads: “السلام علیک و علی الارواح التی حلّت بفنائک و اناخت بساحتک و جاهدت فی الله معک و شرت نفسها ابتغاء مرضات الله فیک”. in this passage there are traits such as fighting in the way of Allah with Imam Husein (as) and martyrdom in the way of Allah (swt) after joining Imam Husein (as); this is also evidence that what is meant by ‘Arwah’ is none other than the companions of Imam Husein (as).
7) In the ‘non-famous’ (gheyr ma’rufah) Ziyarat Ashura, it reads: “السلام علیک یا ابا عبد الله الحسین و علی من ساعدک و عاونک و واساک بنفسه و بذل مهجته فی الذّب عنک... السلام علیک یا مولای و علیهم و علی روحک و علی ارواحهم و علی تربتک و علی تربتهم السلام علیک یابن سید العالمین و علی المستشهدین معک”. This passage clearly shows that what is meant by ‘arwah’ in the famous Ziyarat Ashura, are the companions of Imam Husein (as) who were martyred with him.
8) In the other ziyarats that are to be read at the shrine of this great imam, after greeting the imam and his beloved son, Ali Akbar, it says to turn to the martyrs of Karbala and to address and greet them, this is while in none of these ziyarats has it been said to address and greet the visitors of the imam, or the normal people buried there.
To conclude, what one understands from the whole of the ziyarats of Imam Husein (as) is that it is for sure that what is meant by the ‘Arwah’ who are greeted in Ziyarat Ashura are the companions of Imam Husein (as) who were martyred along with him in Karbala.
 Seyyid ibn Tawus, Iqbalul-A’mal, vol. 3, pg. 70.
 What mentioning fighting after joining the imam implies, is that what is meant by the ‘Arwah’ are those martyred along with Imam Husein (as) on Ashura.
 The ziyarat which shares the same thawab as that of the famous Ziyarat Ashura, which is meant for those who want to recite Ziyarat Ashura but can't carry out all of its adab (formalities and etiquette) such as the takbir, one hundred la’ns, hundred salams, the sajdah, and the dua and prayer after the ziyarat). Mafatihul-Jinan.