Several Zmanim apps are giving a choice on my "candle lighting offset". The default here is 40 minutes instead of the usual 18 minutes I've heard.
Why 40? Why do I even have a choice?
Does the fact that I am in Jerusalem play a role?
The reason why we light candles a few minutes early (18 minutes) is in order to avoid any possibility of starting Shabbat late. Think of it as a train leaving the station. If you're one minute late, you missed it.
By the way, though most communities light Shabbat candles 18 minutes before sunset, local custom may vary. For instance in Jerusalem, the custom is to light 40 minutes before sunset.
Jerusalem lights candles 40 minutes before sunset. (Except for those who don’t follow that custom.) Which sunset? Important question. The standard practice is to count 40 minutes before “sunset of elevation”. Jerusalem is a little over 800m above sea level. If one could see the sun set over a horizon at sea level (which can be done from some parts of J’lem), it would set about 5 minutes later than someone watching from sea level, or seeing the sun set beyond mountains that are approx. the same height as Jerusalem is. Since the sunset on the same plane is 5 minutes earlier, and for Shabbat purposes is the sunset we would have to consider because of the strictness of Shabbat, then J’lem candle lighting time is really only 35 minutes before “the other” sunset.
All other places at some height above sea level have similar problems. Tzfat lights candles 30 minutes before sunset. Official candle lighting for Petach Tikva is 40 minutes before sunset, just like Jerusalem. Not everybody holds by that timing.
Some communities calculate Shabbat out at 33 minutes after sunset. Some use the angle of the sun below the horizon to “end Shabbat” (8.5 deg).
here is the well known custom in Jerusalem to light Shabbat candles 40 minutes before sunset. This custom is derived from a view which requires one to add half of a "halachic hour" to one's Shabbat. This amount of time maximizes to be 40 minutes at the height of summer.[Shita Mekubetzet Beitza 30a] In order to avoid confusion and ensure consistency, this 40 minute period is adhered to all year long even when half a halachic hour would be less than that.
Sorry for the Quotes instead of a summary, but even though I don't start until 18 minutes before sundown Shabbat is coming!!:)
Indeed the custom here in Jerusalem is to light candels 40 minutes before Shekiah. The current Chief Rabbi of Jerusalem, Rabbi Moishe Shternbuch discusses the source of this custom in his book Moadim U'Zmanim (vol 8, siman 156). I will try to elaborate more on this after Shabbos if I remember!