The net present cost of grid extension has two components. The first component is the net present cost of buying power from the grid over the project lifetime. The annual cost of buying power is the power price times the total annual electrical demand, and you divide that annual cost by the capital recovery factor to find the net present cost. That's the y-intercept of the line on the graph. The capital recovery factor is defined in the HOMER help file.

The second component is the net present cost of extending the grid, which is just equal to the net present cost per km times the distance in km. The net present cost per km is the sum of the capital and O&M cost, but you have to divide the O&M cost by the capital recovery factor. The slope of the line is equal to the net present cost per km.