It's a sentence in the past about a repeated/continuous action that happened before another event in the past.
For instance you could come across it in indirect speech
I met Jack earlier and he told me (most recent past event) he had been skiing (previous past event) between 2 and 4 pm yesterday.
Hope it helps
Student or Learner