Could you explain how the accelerometer calibration works

I have been following the space shooter tutorial and am confused with how the accelerometer calibration works . These are the 2 functions that was used

void CalibrateAccelerometer()
    {
        Vector3 accelerationSnapShot = Input.acceleration;
        Quaternion rotateQuaternion = Quaternion.FromToRotation(new Vector3(0.0f, 0.0f, -1.0f), accelerationSnapShot);
        calibrationQuaternion = Quaternion.Inverse(rotateQuaternion);     
    }
    Vector3 FixAccleeration(Vector3 acceleration)
    {
        Vector3 fixedAcceleration = calibrationQuaternion * acceleration;
        return fixedAcceleration
    }

I am not able to understand how the accelerometer is calibrated with the above code .

Using accelerometer axis change like seen in the image.

90812-download.jpg

Here is the YouTube link for accelerometer, You will better understand calibration.

YouTube link