basis comes from IRC code section 1033
(a)General rule
If property (as a result of its destruction in whole or in part, theft, seizure, or requisition or condemnation or threat or imminence thereof) is compulsorily or involuntarily converted—
(1)Conversion into similar property
Into property similar or related in service or use to the property so converted, no gain shall be recognized.
(b)Basis of property acquired through involuntary conversion
(1)Conversions described in subsection (a)(1)
If the property was acquired as the result of a compulsory or involuntary conversion described in subsection (a)(1), the basis shall be the same as in the case of the property so converted—
(A)decreased in the amount of any money received by the taxpayer which was not expended in accordance with the provisions of law (applicable to the year in which such conversion was made) determining the taxable status of the gain or loss upon such conversion, and
(B)increased in the amount of gain or decreased in the amount of loss to the taxpayer recognized upon such conversion under the law applicable to the year in which such conversion was made.
the basis for the land is the basis the grandparents had - a donee takes on the tax basis of the donor
since you rebuilt the house the rules above apply.