It is a past tense of bi to be, it means was, while tha is the present tense: is.
So is robh, it also means was (past tense of bi) – but it is a dependent form used after particles requiring the dependent form: bha mi I was, cha robh mi I was not, an robh mi…? was I…?.
There is no yes word in Gaelic, you answer yes/no questions by repeating the verb. So if the question starts with an robh…? was/were…?, the answer will be either bha for yes or cha robh for no.
And the same pattern for this verb in the present tense: the independent form is tha but dependent is (bh)eil, thus if the question starts with a bheil thu…? are you…? then the answer is either tha for yes or chan eil for no.