The spot yield curve is not a chart of a single treasury bond yield - e.g., 2year of 10 year. The spot yield curve is a graph of zero-coupon bond yields plotted against time. For example, to obtain today's spot yield curve, setting time on the x-axis and yield on the y-axis, you would plot all existing zero-coupon treasury bond yields against time. You would then interpolate between these plot points to obtain a continuous curve - the spot yield curve.
TL;DR
The notes included on the BofA page you have linked describe the BofA Merrill Lynch HY index as a market cap weighted index with a corresponding weighted average time to maturity. Although not explicitly stated in the notes, it would be natural to choose the weighted average time to maturity as the date to compare with the yield on the spot yield curve in order to obtain the spread being charted on the page you have linked.