In edge detection, what value is being compared to the threshold value?
Its simple. The gradient matrix is computed while performing the Canny/Sobel edge detection. No the gradient varies according to the edge. When you digitize this gradient function, you get a value which tells the magnitude of the gradient at that point.

When you threshold. These magnitudes are compared to the threshold value. If you want weak edges, you keep low threshold values. In such a case all minor edges will show up as well.
If you want only strong 'clear' edges, then you keep higher threshold values.