It's something of a Pacific War problem- the only way to neuter British power is to inflict a crippling defeat fast, but the psychological blow of that probably fires up the Empire to hang in no matter what.
Still: If the Boers were to win, they needed to seize control of the lines into their own territory, dig in and hope that the British lose interest.
That means some combination of
A: Seize the major railheads. That means not laying siege to Kimberley, Mafeking and Ladysmith but riding straight in. That'll be bloody, but every day that the commandos sit around a British strongpoint is a day that they're not sitting atop the line that reinforcements will take.
B: Commit to a serious invasion of the Cape, early on, as Smuts proposed. Now, IOTL the Cape Afrikaners never rose against the British apart from a few volunteers. But major incursions only really took place during the guerrilla phase when it was hard to convince people the war was winnable. It is just possible that if the ZAR forces seem to be carrying all before them there'll be a wave of nationalism. It's probably impossible for the Boers to take the Cape colony- but they have a chance of setting the northern reaches alike, and completely cutting off Bechuanaland and Rhodesia.
C: Push for Durban hard. Natal is a softer target than the Cape, but only in as much that the chance of taking the major ports is slim rather than non-existent. But if the Boers drive "Reverse" Bullers before them back towards the sea, before British reinforcements have arrived and while the Treasury screams that the first month of the war has been more expensive than the entire allocated budget for the campaign... well, it helps the chance for an armistice. I doubt they can take Durban. But they can threaten it.
I want to stress that any one of these would be hard for a small, militia based army. Any two would be extremely difficult, and all three together probably impossible.
However, there is a fourth possibility that is not in the Boer control:
D: A Great Power flare up elsewhere. If we delay Fashoda by a year or so, that might do it. I'm not talking about actual military intervention- but the cabinet was always concerned about focusing so much on South Africa when there was a chance their rivals might make mischief. If we can arrange so that there's some kind of crisis that requires an international conference (formal or otherwise) the British might agree to recognise Boer independence in exchange for some symbolic concessions- a limited franchise for the Uitlanders perhaps, or possibly even the sale of Delagoa Bay to the UK.