Before

  1. I started working here two years before.
  2. I started working here before two years.
    Which expression is correct?

1st one

Neither expression is correct, as you cannot use ‘before’ with a period of time in this sense.

I started working here two years ago.
is correct.

Mr. Beeesnees,

  1. I had started working here two years before.
  2. I had started working here before two years.
  3. He had arrived three years before.
    Are all OK? I have used past perfect.
    Can I use in present perfect like below:
  4. I have started working here two years before.

As above, no, they are not grammatically correct sentences. It’s not because of the tense but because of the meaning of ‘before’. You cannot use ‘before’ in that sense. You need a specific point relating to the two years. (‘now’ is not specific enough)

I had started working here two years before <<>>
examples:
I had started working here two years before the present owners took over.
I had started working here two years before the uprising.

‘ago’ = some time back from the present time.
‘before’ = some time back from a point in time which has now passed.

Please look at the comment here:
a few hours before v.s. a few hours ago

Mr. Beeesneees,

  1. Does “I had started working here two years before the uprising.” mean
    “I had started working here for two years before the uprising.” ?
  2. “I had started working here two years”
    Is this sentence correct? What does it mean?
    Should I say “I had started working here for two years.”?
  3. Could I say: “I had started working here before two years.”?
    Thanks
  1. It means you had started working there two years before the uprising took place.

  2. The sentence is not correct because it is incomplete.
    You can either use:
    I have worked here for two years
    or
    I have been working here for two years

  3. No, see point 2.
    or
    I had started work(ing) here two years before .

Mr. Beeesneees,
“1) It means you had started working there two years before the uprising took place.”
In the above sentence you have omitted preposition ‘for’.
For #2 sentence, you have added the preposition ‘for’ and you stated that without ‘for’ the sentence is wrong.
Can I say: “I have worked here two years” without ‘for’?
Could you explain to me the grammar involved? Thanks.

The difference between (1) and (2) is that in (1) you use ‘started’: a specific single point in time. In (2) you use ‘working’: a continuous action over time.
I haven’t “omitted” a preposition from sentence 1. Using ‘for’ there would be incorrect because of the use of ‘to start’ indicating the precise point.

I had started working here / two years before the uprising (took place).
I had worked here / (for) two years before the uprising (took place).
I have worked here / (for) two years.

Mr. Beeesneees,
As per your instruction, I should write as below:

  1. I had started working here two years.
  2. I had worked here for two years.
    Am I correct?
  3. In 2004, he told me he had published a book four years before.
    Is this #3 sentence OK?
    Thanks.

You are trying to make ‘before’ fit where it DOES NOT FIT.

  1. No. As above: I had started working here two years !
  2. No. I had worked here for two years !
  3. No. ‘ago’ would be used there. Not ‘before’.

‘ago’ = some time back from the present time.
‘before’ = some time back from a point in time which has now passed.