It could well be your safe Z setting as I mentioned earlier, looking at your xml you have it set to 2 in machine coords. Your Z travel according to your homing and limits page is 3.63 so in other words your safe Z position is is only 1.63 away from your max Z travel. If you are at a point above that and a safe Z is called then your axis will plunge down to 2 in machine coords.
One other thing to note is you really have the Z axis set wrong in Homing and limits unless of course it is not a convetional machine. Normally the Z Max would be set as zero and the Z Min set as the axis travle but a negative number.
So what I think you should really have is
Z Max Zero
Z Min -3.63
Safe Z could then be something like -0.1
If your machine is not a conventional setup then let me know how it works.
With regards to what Phil has said about the code, it is definitely easier on the eye having the spaces but I dont think Mach cares either way, I could be wrong though
Hood