san nian qian(3 years ago) and qian san nian(first 3 years)

sān nián qián (三年前), means three years agao
qián sān nián (前三年), mean the first three years.

If qián is after number/time, qian means ago, while if qián is before the number/time, it means first.

other examples:
shí fēn zhōng hòu
十分钟后,ten minutes later
hòu shí fēn zhōng
后十分钟,last ten minutes
xīng qián
一个星期前,a week ago
qián xīng
前一个星期, first one week