"A Z-score is simply the comparison of an actual alignment score with the scores obtained on a set of random sequences by a Monte-Carlo process. Scores are calculated using the Smith & Waterman [SW81] algorithm." https://www.weizmann.ac.il/csb/faculty_pages/Sussman/pdb25sp10/abstracts/Comet.html
Basically, when you do a template alignment in preparation for homology modelling, you need to find the proper sequence alignment between your query sequence and the sequence embodied in the template structure. The z-score indicates whether there is indeed a significant similarity between the two sequences, which is a prerequisite for successful homology modelling.