In the opening clause of every parliamentary act seems to appear this phrase. What does each type of Lord refer to?
See UK Parliament Glossary, "Lords Spiritual and Temporal":
The Lords Spiritual are made up of the Archbishops of Canterbury and of York, the Bishops of London, Durham and Winchester as well as specific bishops of the Church of England.
The Lords Temporal are made up of Life Peers, the Earl Marshal, Lord Great Chamberlain, Hereditary Peers elected under the Standing Orders.
The division between these categories of peers is of ancient origin. Ecclesiastical dignitaries, such as bishops, hold an office given to them by the Church; whereas noblemen, such as earls, hold titles given to them or an ancestor by the Crown. While the extent to which either system was really in charge was greatly contested historically (can kings choose or veto bishops? can the Pope get rid of a king? etc.), both groups were significant enough that they had to be represented in royal councils. Political theory of the Middle Ages, and earlier, had a great deal to say about the power and relationships of these authorities, but the main point is that "church stuff" and "secular government stuff" were seen as two separate things, albeit interconnected.
These English words "spiritual" and "temporal" are direct translations of French words used in mediaeval legal language, which themselves come from Latin. "Temporal", or "existing in time", refers to things associated with this present world, in distinction to "spiritual" things which transcend it, i.e. relating to God and the Church. These are theologically loaded words because they come from Christian doctrine, in a strand of Western theology coming through Augustine to the mediaeval scholastics and therefore into political thought of the time.
Even before the present enacting formula was settled, statutes often included some sort of reference to the various people in Parliament who had given their assent. Without trying to list all the variations, a typical example is 36 Edward III c.1 (the Confirmation of Charters, etc. Act 1362), which has (in French; this and other quotations are followed by my translations):
p assent des Prelatz, Ducs, Countez, Barons et autres gantz
by assent of the prelates, dukes, earls, barons and other great men
or the Latin of 25 Edward I c.1 (the Restraint on Taxation, Purveyance, etc. Act 1297),
assensu communi Archiepiscoporum, Episcoporum, Abbatum et aliorum Praelatorum, Comitum, Baronum, Militum, Burgensium, et aliorum liberorum hominum
the assent of all archbishops, bishops, abbots and other prelates, the earls, barons, knights, burgesses and other free men
We see here the classic notion of the three estates of society (clergy, nobility, everyone else) by the ordering of the titles, even though they are not grouped in the classes of "lords spiritual", "lords temporal", and "commons". Over time, the precise composition has varied. The 1297 Act does not mention dukes, because there weren't any in England at the time. It does call out abbots, who were only rarely summoned to parliament, and not at all after the dissolution of the monasteries under Henry VIII.
The specific terms for "lords spiritual" and "lords temporal" were frequently used from the reign of Richard II. For example, the law 16 Ric II c.5, now called "The Statute of Praemunire 1392", recites that the lords spiritual were examined in council on certain contentious examples of papal power:
ce demandez estoit des ẜrs esp̃uels [...] cestassavoir Ercevesq̃s Evesq̃s et autꝯs pꝯlats [...]
It was demanded of the lords spiritual ... that is to say, the archbishops, bishops, and other prelates [....]
It also speaks about the lords temporal (seigneurs temporals) as a separate category.
The clergy may also have "temporalities", which are properties they hold according to the secular legal system. When a bishop is invested, by the nature of their appointment they immediately receive the "spiritualities" of the office, effectively the power to run the diocese, and separately are given the temporalities by order of the Crown. At various times, bishops have been required to declare that their temporalities came from the Crown as opposed to from the Pope, which is part of an attempt to draw the temporal-spiritual line in a certain place (and to deny the authority of a foreign power to overrule the king). It is also a bit muddy that bishops are nominally chosen by the dean and chapter of their see - but in fact they are required to choose the person named in the congé d'élire given to them by the King on the advice of ministers - but in fact the ministers are effectively bound to advise the King to name the person that the church wants anyway. Notwithstanding all of this, the bishops in the House of Lords are still Lords Spiritual, because they sit there by virtue of their spiritual office.